package com.dst.smart.provider;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;

import com.dst.smart.utils.ConfigUtil;

/**
 * AIUI配置Provider。
 * 
 * @author <a href="http://www.xfyun.cn">讯飞开放平台</a>
 * @date 2016年6月12日 上午8:58:54 
 *
 */
public class AIUIConfigProvider extends ContentProvider {
	private static final String TAG = "AIUIConfigProvider";
	
	private static final String METHOD_READAIUICFG = "readAIUICfg";
	
	@Override
	public boolean onCreate() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public Cursor query(Uri uri, String[] projection, String selection,
			String[] selectionArgs, String sortOrder) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getType(Uri uri) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Uri insert(Uri uri, ContentValues values) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int delete(Uri uri, String selection, String[] selectionArgs) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int update(Uri uri, ContentValues values, String selection,
			String[] selectionArgs) {
		// TODO Auto-generated method stub
		return 0;
	}
	
	@Override
	public Bundle call(String method, String arg, Bundle extras) {
		if (METHOD_READAIUICFG.equals(method)) {
			String config = readAIUICfg();
			
			Bundle bundle = new Bundle();
			bundle.putString("config", config);
			
			return bundle;
		}
		
		return super.call(method, arg, extras);
	}
	
	private String readAIUICfg() {
		String config = ConfigUtil.readAssetsCfg(getContext(), "cfg/aiui.cfg");
		return config;
	}
	
}
